<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePlayerWechat extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('player_wechat', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('player_id')
                  ->nullable(false)
                  ->default(0)
                  ->comment('关联玩家ID');
            $table->char('open_id', 28)
                  ->nullable(false)
                  ->default('')
                  ->comment('微信 OpenId');
            $table->string('nickname', 20)
                  ->nullable(false)
                  ->default('')
                  ->comment('微信昵称');
            $table->string('avatar', 150)
                  ->nullable(false)
                  ->default('')
                  ->comment('微信头像');
            $table->unsignedTinyInteger('gender')
                  ->nullable(false)
                  ->default(0)
                  ->comment('微信性别');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('player_wechat');
    }
}
